package com.hotel.project.system.guestroom.service;

import com.hotel.common.support.Convert;
import com.hotel.project.system.guestroom.domain.GuestRoom;
import com.hotel.project.system.guestroom.mapper.GuestRoomMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 客房 服务层实现
 *
 * @author pluto
 * @date 2019-04-06
 */
@Service
public class GuestRoomServiceImpl implements IGuestRoomService {
    @Autowired
    private GuestRoomMapper guestRoomMapper;

    /**
     * 查询客房信息
     *
     * @param id 客房ID
     * @return 客房信息
     */
    @Override
    public GuestRoom selectGuestRoomById(Integer id) {
        return guestRoomMapper.selectGuestRoomById(id);
    }

    /**
     * 查询客房列表
     *
     * @param guestRoom 客房信息
     * @return 客房集合
     */
    @Override
    public List<GuestRoom> selectGuestRoomList(GuestRoom guestRoom) {
        return guestRoomMapper.selectGuestRoomList(guestRoom);
    }

    /**
     * 新增客房
     *
     * @param guestRoom 客房信息
     * @return 结果
     */
    @Override
    public int insertGuestRoom(GuestRoom guestRoom) {
        guestRoom.setCreateTime(new Date());
        return guestRoomMapper.insertGuestRoom(guestRoom);
    }

    /**
     * 修改客房
     *
     * @param guestRoom 客房信息
     * @return 结果
     */
    @Override
    public int updateGuestRoom(GuestRoom guestRoom) {
        return guestRoomMapper.updateGuestRoom(guestRoom);
    }

    /**
     * 删除客房对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteGuestRoomByIds(String ids) {
        return guestRoomMapper.deleteGuestRoomByIds(Convert.toStrArray(ids));
    }

}
